package com.java.yihur.stimulateduck.advancedduck.ducks;

import com.java.yihur.stimulateduck.advancedduck.flybehavior.FlyBehavior;
import com.java.yihur.stimulateduck.advancedduck.quackbehavior.QuackBehavior;
import com.java.yihur.stimulateduck.advancedduck.swimbehavior.SwimBehavior;

public abstract class BaseDuck {

    /**
     * 飞行动作接口
     */
    FlyBehavior mFlyBehavior;

    /**
     * 鸭子叫声接口
     */
    QuackBehavior mQuackBehavior;

    /**
     * 游泳接口
     */
    SwimBehavior mSwimBehavior;

    public BaseDuck() {

    }

    /**
     * 种类
     */
    public abstract void display();

    public void fly() {
        mFlyBehavior.fly();
    }

    /**
     * 设置新的飞行行为
     * @param flyBehavior
     */
    public void setFlyBehavior(FlyBehavior flyBehavior) {
        mFlyBehavior = flyBehavior;
    }

    public void quack() {
        mQuackBehavior.quack();
    }

    /**
     * 设置新的叫声属性
     * @param quackBehavior
     */
    public void setQuackBehavior(QuackBehavior quackBehavior) {
        mQuackBehavior = quackBehavior;
    }

    public void swim() {
        mSwimBehavior.swim();
    }

}
